package a51qindian.com.comprehensive.activity;

import android.content.Intent;
import android.view.View;

import com.li.widget.TopNavigationBar;

import a51qindian.com.comprehensive.App;
import a51qindian.com.comprehensive.R;
import a51qindian.com.comprehensive.base.QDBaseActivity;
import a51qindian.com.comprehensive.util.SpUtil;
import butterknife.BindView;
import butterknife.OnClick;

/**
 * Author: Li
 * Date: 2017/10/9 0009
 * Description: 设置界面
 */

public class SettingActivity extends QDBaseActivity {

    @BindView(R.id.top_navigation)
    TopNavigationBar mTopNavigation;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_setting;
    }

    @Override
    protected void initSth() {
        super.initSth();
        mTopNavigation.setNavigationBarListener(this);
    }

    @OnClick({R.id.txt_reset, R.id.btn_logout})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.txt_reset:
                Intent intent=new Intent(SettingActivity.this,ResetPwdActivity.class);
                intent.putExtra("source","setting");
                startActivity(intent);
                break;
            case R.id.btn_logout:
                Intent logoutIntent = new Intent(this, LoginActivity.class);
                logoutIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
                App.finishAll();
                App.clearActivity();
                SpUtil.clearUserInfo(this);
                startActivity(logoutIntent);
                finish();
                break;
        }
    }
}
